<!DOCTYPE html>
<!--suppress ALL-->
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="b">
    <div class="row" style="margin-top: 5px">
        <!--商品分类列表和推荐商品-->
        <div class="col-md-3">
            <div th:include="common/menuSortAndRecommend::#m"></div>
        </div>
        <!--商品详情-->
        <div class="col-md-9 card">
            <hr>
            <div class="row inline">
                <div class="col-md-5  card-body">
                    <div>
                        <img th:src="@{'/static/images/articleImage/'+${goods.imageName}+'.jpg'}" class="img-thumbnail"
                             alt="" style="width: 100%">
                    </div>
                </div>
                <div class="col-md-7 card-body">
                    <h4 th:text="${goods.name}" style="color: #b52b27"></h4>
                    <p>发布时间：<span th:text="${#dates.format(goods.addTime,'yyyy-MM-dd HH:mm:ss')}"></span></p>
                    <p class="card-text">价格：￥<span th:text="${goods.priceNow}"></span>&nbsp;&nbsp;&nbsp;&nbsp;<del
                            th:if="${goods.priceLast!=0&&goods.priceLast>goods.priceNow}"
                            style="color: darkred">￥
                    </del>
                        <del style="color: darkred"
                             th:text="${goods.priceLast}"
                             th:if="${goods.priceLast!=0&&goods.priceLast>goods.priceNow}"></del>
                    </p>
                    <p>所属类别：<span th:text="${goods.goodsTypeName}"></span></p>
                    <p>
                        <a th:href="'javascript:addGoodsToShoppingCart('+${goods.id}+')'" style="text-decoration: none"
                           th:if="${goods.goodsTypeId!=8&&session.currentUser!=null&&session.currentUser.id!=goods.userId&&goods.state!=4}">
                            <button type="button" class="btn btn-sm btn-primary">加入购物车</button>
                        </a>
                        <span><strong style="color: red"
                                      th:if="${session.currentUser!=null&&session.currentUser.id==goods.userId}">这是你自己的商品，无法购买哦</strong>
                    </span>
                    <p style="color: red"
                       th:if="${goods.goodsTypeId!=8&&session.currentUser==null}">登录后才可以购物</p>
                    <a href="/toLoginPage" style="text-decoration: none"
                       th:if="${goods.goodsTypeId!=8&&session.currentUser==null}">
                        <button type="button" class="btn btn-primary btn-sm">
                            马上登录
                        </button>
                    </a>
                    <button type="button" class="btn btn-success btn-sm" data-toggle="modal" data-target="#myModal">
                        <span th:text="${goods.goodsTypeId!=8?'获取卖家联系方式':'获取求购者联系方式'}"></span>
                    </button>
                </div>
            </div>
            <hr>
            <h3><span class="badge badge-info">详情</span></h3>
            <p th:utext="${goods.content}"></p>
        </div>
        <!-- 模态框 -->
        <div class="modal fade" id="myModal">
            <div class="modal-dialog modal-lg">
                <div class="modal-content">

                    <!-- 模态框头部 -->
                    <div class="modal-header">
                        <h4 class="modal-title">卖家联系方式</h4>
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                    </div>

                    <!-- 模态框主体 -->
                    <div class="modal-body">
                        <span th:if="${session.currentUser==null}">登录后才能<span
                                th:text="${goods.goodsTypeId!=8?'获取卖家联系方式':'获取求购者联系方式'}"></span>哦，去<a
                                href="/toLoginPage"><button
                                type="button"
                                class="btn btn-primary">登录</button></a></span>
                        <span>邮箱：<span th:text="${emailStr}"
                                       th:if="${goods.contactInformationList.size()==0}"></span></span>
                        <table class="table table-bordered table-striped table-hover table-borderless"
                               style="margin-top: 4px"
                               th:if="${goods.contactInformationList.size()>0&&session.currentUser!=null}">
                            <thead>
                            <tr>
                                <th style="text-align: center">名称</th>
                                <th style="text-align: center">内容</th>
                            </tr>
                            </thead>
                            <tbody>
                            <div th:each="contactInformation:${goods.contactInformationList}">
                                <tr>
                                    <td style="text-align: center" th:text="${contactInformation.name}"></td>
                                    <td style="text-align: center" th:text="${contactInformation.content}"></td>
                                </tr>
                            </div>
                            </tbody>
                        </table>
                    </div>

                    <!-- 模态框底部 -->
                    <div class="modal-footer">
                        <button type="button" class="btn btn-danger" data-dismiss="modal">关闭</button>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>